<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@   taglib uri="http://java.sun.com/jsp/jstl/core"  prefix="c" %> 
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html >
<html>
<head>
	<base href="<%=basePath%>">
     <meta charset="utf-8">

        <title> Lexy - 发布博客 </title>

　　<meta name="keywords" content="lexy,Lexyui,lexyui,lexy博客"> 
        <meta name="description" content="lexy 博客站">
        <meta name="author" content="lexy">
        <meta name="robots" content="noindex, nofollow">
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">

        <!-- Icons -->
        <!-- The following icons can be replaced with your own, they are used by desktop and mobile browsers -->
        <link rel="shortcut icon" href="plugins/v2/img/favicons/favicon.png">

        <link rel="icon" type="image/png" href="plugins/v2/img/favicons/favicon-16x16.png" sizes="16x16">
        <link rel="icon" type="image/png" href="plugins/v2/img/favicons/favicon-32x32.png" sizes="32x32">
        <link rel="icon" type="image/png" href="plugins/v2/img/favicons/favicon-96x96.png" sizes="96x96">
        <link rel="icon" type="image/png" href="plugins/v2/img/favicons/favicon-160x160.png" sizes="160x160">
        <link rel="icon" type="image/png" href="plugins/v2/img/favicons/favicon-192x192.png" sizes="192x192">

        <link rel="apple-touch-icon" sizes="57x57" href="plugins/v2/img/favicons/apple-touch-icon-57x57.png">
        <link rel="apple-touch-icon" sizes="60x60" href="plugins/v2/img/favicons/apple-touch-icon-60x60.png">
        <link rel="apple-touch-icon" sizes="72x72" href="plugins/v2/img/favicons/apple-touch-icon-72x72.png">
        <link rel="apple-touch-icon" sizes="76x76" href="plugins/v2/img/favicons/apple-touch-icon-76x76.png">
        <link rel="apple-touch-icon" sizes="114x114" href="plugins/v2/img/favicons/apple-touch-icon-114x114.png">
        <link rel="apple-touch-icon" sizes="120x120" href="plugins/v2/img/favicons/apple-touch-icon-120x120.png">
        <link rel="apple-touch-icon" sizes="144x144" href="plugins/v2/img/favicons/apple-touch-icon-144x144.png">
        <link rel="apple-touch-icon" sizes="152x152" href="plugins/v2/img/favicons/apple-touch-icon-152x152.png">
        <link rel="apple-touch-icon" sizes="180x180" href="plugins/v2/img/favicons/apple-touch-icon-180x180.png">
        <!-- END Icons -->

        <!-- Stylesheets -->
        <!-- Web fonts -->
        <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400italic,600,700%7COpen+Sans:300,400,400italic,600,700">

		<!-- Page JS Plugins CSS -->
		
	    <link rel="stylesheet" href="plugins/v2/js/plugins/select2/select2.min.css">
    	<link rel="stylesheet" href="plugins/v2/js/plugins/select2/select2-bootstrap.min.css">
    	<link rel="stylesheet" href="plugins/v2/js/plugins/jquery-tags-input/jquery.tagsinput.min.css">
		
        <link rel="stylesheet" href="plugins/v2/js/plugins/summernote/summernote.min.css">
        <link rel="stylesheet" href="plugins/v2/js/plugins/simplemde/simplemde.min.css">



        <!-- Bootstrap and OneUI CSS framework -->
        <link rel="stylesheet" href="plugins/v2/css/bootstrap.min.css">
        <link rel="stylesheet" id="css-main" href="plugins/v2/css/oneui.css">

        <!-- You can include a specific file from css/themes/ folder to alter the default color theme of the template. eg: -->
        <style type="text/css">
/* 			 .content.content-boxed {
				    max-width: 95%;
				} */
        </style>
        
    </head>
    <body>
        <!-- Page Container -->
        <div id="page-container" class="side-scroll header-navbar-fixed header-navbar-transparent">

            <!-- Header -->
            <jsp:include page="temple/_top_all.jsp"></jsp:include>
            <!-- END Header -->

            <!-- Main Container -->
            <main id="main-container">
            
            	<div style="height:60px"></div>
				<section class="content content-boxed">
						<div class="row">
							<div class="col-md-12">
								<!-- New Topic -->
		                    <div class="block">
		                        <div class="block-header bg-gray-lighter">
		                            <h3 class="block-title"><i class="fa fa-plus"></i> 发表新文章</h3>
		                        </div>
		                        <div class="block-content block-content-full block-content-narrow">
		                            <form class="form-horizontal  push-10-t" id="blog_content_form"  action="v2/blog/insertBlog" onsubmit="return false;">
		                                <div class="form-group">
		                                    <div class="col-md-8">
		                                        <div class="form-material form-material-primary">
		                                            <input class="form-control" type="text" id="title" name="title" placeholder="请填写主题标题...">
		                                            <label for="title">主题标题 <span class="text-danger">*</span></label>
		                                        </div>
		                                    </div>
		                                </div>
<!-- 		                                <div class="form-group">
		                                    <div class="col-md-8">
		                                        <div class="form-material form-material-primary">
		                                            <input class="form-control" type="text" id="desc" name="desc" placeholder="请填写主题描述...">
		                                            <label for="desc">主题描述</label>
		                                        </div>
		                                    </div>
		                                </div> -->
		                                <div class="form-group">
		                                    <div class="col-md-8">
		                                        <!-- Select2 (.js-select2 class is initialized in App() -> uiHelperSelect2()) -->
		                                        <!-- For more info and examples you can check out https://github.com/select2/select2 -->
		                                        <div class="form-material form-material-primary">
		                                            <select class="js-select2 form-control" id="type" name="type" style="width: 100%;" data-placeholder="请选择主题类型...">
		                                                <option></option>
		                                                <option value="1">- 博客</option>
		                                                <option value="2">- 图文</option>
		                                            </select>
		                                            <label for="type">主题类型 <span class="text-danger">*</span></label>
		                                        </div>
		                                    </div>
		                                </div>
		                                <div class="form-group">
		                                    <div class="col-md-8">
		                                        <!-- jQuery Tags Input (.js-tags-input class is initialized in App() -> uiHelperTagsInput()) -->
		                                        <!-- For more info and examples you can check out https://github.com/xoxco/jQuery-Tags-Input -->
		                                        <div class="form-material form-material-primary">
		                                            <input class="js-tags-input form-control" type="text" id="topic-tags" name="topic-tags" value="Question">
		                                            <label for="topic-tags">主题标签 <span class="text-danger">*</span></label>
		                                        </div>
		                                    </div>
		                                </div>
		                                
		                                 <div class="form-group">
		                                            <div class="col-xs-12">
		                                                <div class="form-material">
		                                                    <input class="form-control" id="fileToUpload" type="file" name="upfile"><br>
		                                                    <label for="fileToUpload">文件域</label>
		                                                </div>
		                                            </div>
		                                        </div>
		                                <div class="form-group">
		                                    <div class="col-xs-12">
							                    <!-- <div class="block"> -->
					                            <div class="form-material form-material-primary">
						                            <!-- Summernote Container -->
						                            <input type="hidden" id="content" name="content">
						                            <div class="js-summernote">Hello Summernote!</div>
						                        	<label for="topic-tags">主题内容</label>
							                    </div>
		                                    </div>
		                                </div>
		                                <input type="hidden" id="status" name="status" />
		                                <input type="hidden" id="serialId" name="serialId" value="${serialId}"/>
		                                
		                                <div class="form-group">
                                            <div class="col-xs-12">
                                                <div class="form-material">
                                                    <div class="col-sm-12">
				                                    <label class="css-input css-radio css-radio-warning push-10-r">
				                                          <input type="radio" name="push_status" value="0" checked="checked"><span></span> 公开
				                                    </label>
				                                    <label class="css-input css-radio css-radio-warning">
				                                          <input type="radio" name="push_status" value="1"><span></span> 私密(仅自己可见)
				                                    </label>
				                                </div>
                                                    <label for="push_status">发布状态</label>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="form-group">
		                                    <div class="col-xs-12">
		                                        <button id="push_blog" class="btn btn-sm btn-primary" type="type"><i class="fa fa-plus"></i> 发布主题</button>
		                                        <!-- <button class="btn btn-sm btn-default" type="button"><i class="fa fa-eye"></i> 预览</button> -->
		                                        <button id="add_blog" class="btn btn-sm btn-default" type="button"><i class="fa fa-floppy-o"></i> 保存至草稿箱</button>
		                                    </div>
		                                </div>
		                            </form>
		                        </div>
		                    </div>
		                    <!-- END New Topic -->
		                    </div>
<%-- 							<div class="col-md-5">
								<div class="block ">
		                                <div class="block-header bg-gray-lighter">
		                                    <h3 class="block-title">设置封面</h3>
		                                </div>
		                                <div class="block-content block-content-full block-content-narrow">
		                                    <form class="form-horizontal push-10-t push-10" >
		                                        <div class="form-group">
		                                            <div class="col-xs-12">
		                                                <div class="form-material">
		                                                    <div style="height:auto;width:100%;max-height:200px;">
							                                	<img src="content/admin/timg.jpg" id="blog_img" style="width:100%;" alt=""> 
							                                </div>
		                                                    <label for="thumbnail">预览</label>
		                                                </div>
		                                            </div>
		                                        </div>
		                                        <div class="form-group">
		                                            <div class="col-xs-12">
		                                                <div class="form-material">
		                                                    <input class="form-control" id="fileToUpload" type="file" name="upfile"><br>
		                                                    <label for="fileToUpload">文件域</label>
		                                                </div>
		                                            </div>
		                                        </div>
		                                    </form>
		                                    
		                                    <jsp:include page="fullavatareditor.jsp"></jsp:include>
		                                </div>
		                            </div>
							</div> --%>
							
							<!-- <div class="col-md-4">
								<div class="block ">
		                                <div class="block-header bg-gray-lighter">
		                                    <h3 class="block-title">操作</h3>
		                                </div>
		                                <div class="block-content block-content-full block-content-narrow">
		                                    <form class="form-horizontal push-10-t push-10" onsubmit="return false;" >
		                                        <div class="form-group">
		                                            <div class="col-xs-12">
		                                                <div class="form-material">
		                                                    <div class="col-sm-12">
						                                    <label class="css-input css-radio css-radio-warning push-10-r">
						                                          <input type="radio" name="push_status" value="0" checked="checked"><span></span> 公开
						                                    </label>
						                                    <label class="css-input css-radio css-radio-warning">
						                                          <input type="radio" name="push_status" value="1"><span></span> 私密(仅自己可见)
						                                    </label>
						                                </div>
		                                                    <label for="push_status">发布状态</label>
		                                                </div>
		                                            </div>
		                                        </div>
		                                        <div class="form-group">
				                                    <div class="col-xs-12">
				                                        <button id="push_blog" class="btn btn-sm btn-primary" type="type"><i class="fa fa-plus"></i> 发布主题</button>
				                                        <button class="btn btn-sm btn-default" type="button"><i class="fa fa-eye"></i> 预览</button>
				                                        <button id="add_blog" class="btn btn-sm btn-default" type="button"><i class="fa fa-floppy-o"></i> 保存至草稿箱</button>
				                                    </div>
				                                </div>
		                                    </form>
		                                </div>
		                            </div>
							</div> -->
						</div>            
				</section>
            </main>
            <!-- END Main Container -->

            <!-- Footer -->
      			<jsp:include page="temple/_footer_all.jsp"></jsp:include>
            <!-- END Footer -->
        </div>
        <!-- END Page Container -->

        <!-- OneUI Core JS: jQuery, Bootstrap, slimScroll, scrollLock, Appear, CountTo, Placeholder, Cookie and App.js -->
        <script src="plugins/v2/js/core/jquery.min.js"></script>
        <script src="plugins/v2/js/core/bootstrap.min.js"></script>
        <script src="plugins/v2/js/core/jquery.slimscroll.min.js"></script>
        <script src="plugins/v2/js/core/jquery.scrollLock.min.js"></script>
        <script src="plugins/v2/js/core/jquery.appear.min.js"></script>
        <script src="plugins/v2/js/core/jquery.countTo.min.js"></script>
        <script src="plugins/v2/js/core/jquery.placeholder.min.js"></script>
        <script src="plugins/v2/js/core/js.cookie.min.js"></script>
        <script src="plugins/v2/js/app.js"></script>
        <script src="plugins/v2/js/pub.js"></script>


		<!-- Page JS Plugins -->
        <script src="plugins/v2/js/plugins/summernote/summernote.min.js"></script>
        <script src="plugins/v2/js/plugins/select2/select2.full.min.js"></script>
        <script src="plugins/v2/js/plugins/jquery-tags-input/jquery.tagsinput.min.js"></script>


		<!-- Page JS Plugins -->
		<script src="plugins/v2/js/plugins/jquery-validation/jquery.validate.min.js"></script>
        <!-- Page JS Code -->
        <script>
            jQuery(function () {
                // Init page helpers (Appear + CountTo plugins)
            	 App.initHelpers(['select2', 'tags-inputs']);
                
                
            });
            
            $(function(){
            	
	            $('.js-summernote').summernote({
	            	lang: 'zh-CN',
	                height: 350,
	                minHeight: null,
	                maxHeight: null,
	                callbacks: {  
	                    onImageUpload: function(files) { //the onImageUpload API  
	                        img = uploadFile(files);  
	                	}  
	                }
	            })
            })
            
            function uploadFile(files) {  
                
            	var html = "<div>";
            	
                for(var i = 0 ; i<files.length ; i++){
	                var data = new FormData();  
	                data.append("file", files[i]);  
	                
	                
	                
	                
	               $.ajax({  
	                    data: data,  
	                    type: "POST",  
	                    url: "file/uploadFile",  
	                    cache: false,  
	                    contentType: false,  
	                    processData: false,  
	                    async: false,
	                    success: function(data) {  
	                    	console.log(data);
	                    	if(data.code=="200"){
	                        	html += "<img src='"+data.detail.imgUrl+"'      data-filename ='"+data.detail.oldName+"'    >";
	                    	}
	                        //  $("#summernote").summernote('insertImage', url, 'image name'); // the insertImage API  
	                    }  
	                }); 
                }
                html += "</div>";
                
                console.log(html);
                
               	$(".js-summernote").summernote('code', html); // the insertImage API  
            }  
        </script>
    </body>
</html>